package com.sunny.example.hwrealexame;

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

/**
 * 停车场车辆统计
 */
public class Exame2 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        while (scanner.hasNext()) {
            String input = scanner.nextLine();
            String[] strs = input.split(",");

            int result = 0;
            int a = 0;
            List<Integer> list = new ArrayList<>();
            for (int i = 0; i < strs.length; i++) {
                int front = Integer.parseInt(strs[i]);
                if (front == 1) {
                    a++;
                    if (i == strs.length - 1) {
                        list.add(a);
                    }
                    continue;
                }
                list.add(a);
                a = 0;
            }
            for (Integer in : list) {
                while (in > 3) {
                    result++;
                    in -= 3;
                }
                if (in != 0) {
                    result++;
                }
            }
            System.out.println(result);
        }

    }
}
